home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 17659 < prev    next >
Mailbox/MIME Entity  |  1996-08-05  |  2.2 KB

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: Mailbox/MIME Entity (archive/mbox).

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert Newsgroup Content (archive/news) magic Supported
100% dexvert Mailbox/MIME Entity (archive/mbox) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file news text default
99% file C++ source text default
98% file C++ source, ASCII text default
100% checkBytes Printable ASCII default
100% dexmagic PrintFox/Pagefox WEAK default
100% perlTextCheck Likely Text (Perl) default
100% siegfried fmt/950 MIME Email (1.0) default
100% detectItEasy Format: plain text[LF] default (weak)
100% xdgMime message/news default



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 50 61 74 68 3a 20 65 70 | 73 6f 6e 67 77 32 2e 65 |Path: ep|songw2.e|
|00000010| 70 73 6f 6e 2e 63 6f 2e | 6a 70 21 65 70 73 6f 6e |pson.co.|jp!epson|
|00000020| 67 77 21 75 73 65 6e 65 | 74 0a 46 72 6f 6d 3a 20 |gw!usene|t.From: |
|00000030| 6d 61 74 75 73 69 74 61 | 40 68 76 2e 65 70 73 6f |matusita|@hv.epso|
|00000040| 6e 2e 63 6f 2e 6a 70 20 | 28 48 69 72 6f 73 68 69 |n.co.jp |(Hiroshi|
|00000050| 2d 4d 41 54 53 55 53 48 | 49 54 41 29 0a 4e 65 77 |-MATSUSH|ITA).New|
|00000060| 73 67 72 6f 75 70 73 3a | 20 63 6f 6d 70 2e 6c 61 |sgroups:| comp.la|
|00000070| 6e 67 2e 63 2b 2b 2c 66 | 6a 2e 6c 61 6e 67 2e 63 |ng.c++,f|j.lang.c|
|00000080| 2b 2b 0a 53 75 62 6a 65 | 63 74 3a 20 5b 51 5d 57 |++.Subje|ct: [Q]W|
|00000090| 68 65 6e 20 74 65 6d 70 | 6f 72 61 72 79 20 6f 62 |hen temp|orary ob|
|000000a0| 6a 65 63 74 20 62 65 20 | 63 72 65 61 74 65 64 3f |ject be |created?|
|000000b0| 0a 44 61 74 65 3a 20 31 | 37 20 41 70 72 20 31 39 |.Date: 1|7 Apr 19|
|000000c0| 39 36 20 30 39 3a 32 30 | 3a 33 32 20 2b 30 39 30 |96 09:20|:32 +090|
|000000d0| 30 0a 4f 72 67 61 6e 69 | 7a 61 74 69 6f 6e 3a 20 |0.Organi|zation: |
|000000e0| 53 45 49 4b 4f 20 45 50 | 53 4f 4e 20 43 4f 52 50 |SEIKO EP|SON CORP|
|000000f0| 4f 52 41 54 49 4f 4e 2c | 20 49 6e 74 65 72 6e 61 |ORATION,| Interna|
|00000100| 6c 2e 0a 53 65 6e 64 65 | 72 3a 20 6d 61 74 75 73 |l..Sende|r: matus|
|00000110| 69 74 61 40 68 76 33 30 | 2e 68 76 2e 65 70 73 6f |ita@hv30|.hv.epso|
|00000120| 6e 2e 63 6f 2e 6a 70 0a | 4d 65 73 73 61 67 65 2d |n.co.jp.|Message-|
|00000130| 49 44 3a 20 3c 76 7a 6c | 6f 6a 76 6e 31 6b 66 2e |ID: <vzl|ojvn1kf.|
|00000140| 66 73 66 40 68 76 33 30 | 2e 68 76 2e 65 70 73 6f |fsf@hv30|.hv.epso|
|00000150| 6e 2e 63 6f 2e 6a 70 3e | 0a 52 65 70 6c 79 2d 54 |n.co.jp>|.Reply-T|
|00000160| 6f 3a 20 6d 61 74 75 73 | 69 74 61 40 68 76 2e 65 |o: matus|ita@hv.e|
|00000170| 70 73 6f 6e 2e 63 6f 2e | 6a 70 0a 4e 4e 54 50 2d |pson.co.|jp.NNTP-|
|00000180| 50 6f 73 74 69 6e 67 2d | 48 6f 73 74 3a 20 68 76 |Posting-|Host: hv|
|00000190| 33 30 2e 65 70 73 6f 6e | 2e 63 6f 2e 6a 70 0a 4d |30.epson|.co.jp.M|
|000001a0| 69 6d 65 2d 56 65 72 73 | 69 6f 6e 3a 20 31 2e 30 |ime-Vers|ion: 1.0|
|000001b0| 0a 43 6f 6e 74 65 6e 74 | 2d 54 79 70 65 3a 20 74 |.Content|-Type: t|
|000001c0| 65 78 74 2f 70 6c 61 69 | 6e 3b 20 63 68 61 72 73 |ext/plai|n; chars|
|000001d0| 65 74 3d 55 53 2d 41 53 | 43 49 49 0a 58 2d 45 6d |et=US-AS|CII.X-Em|
|000001e0| 61 63 73 3a 20 4d 75 6c | 65 20 32 2e 33 20 28 20 |acs: Mul|e 2.3 ( |
|000001f0| 3d 3f 49 53 4f 2d 32 30 | 32 32 2d 4a 50 3f 42 3f |=?ISO-20|22-JP?B?|
|00000200| 47 79 52 43 52 69 74 46 | 4a 6a 4a 57 47 79 68 43 |GyRCRitF|JjJWGyhC|
|00000210| 3f 3d 20 29 20 62 61 73 | 65 64 20 6f 6e 20 31 39 |?= ) bas|ed on 19|
|00000220| 2e 33 30 0a 58 2d 4d 55 | 41 3a 20 74 6d 2d 67 6e |.30.X-MU|A: tm-gn|
|00000230| 75 73 20 35 2e 20 28 47 | 6e 75 73 20 76 35 29 2c |us 5. (G|nus v5),|
|00000240| 20 74 6d 2d 76 69 65 77 | 20 36 2e 37 36 0a 58 2d | tm-view| 6.76.X-|
|00000250| 4e 65 77 73 72 65 61 64 | 65 72 3a 20 47 6e 75 73 |Newsread|er: Gnus|
|00000260| 20 76 35 2e 30 0a 0a 57 | 68 65 6e 20 61 20 74 65 | v5.0..W|hen a te|
|00000270| 6d 70 6f 72 61 72 79 20 | 6f 62 6a 65 63 74 20 77 |mporary |object w|
|00000280| 69 6c 6c 20 62 65 20 63 | 72 65 61 74 65 64 3f 0a |ill be c|reated?.|
|00000290| 0a 53 75 70 70 6f 73 65 | 2c 20 49 20 63 72 65 61 |.Suppose|, I crea|
|000002a0| 74 65 20 61 20 63 6c 61 | 73 73 20 6e 61 6d 65 64 |te a cla|ss named|
|000002b0| 20 50 45 52 53 4f 4e 20 | 74 68 61 74 20 74 61 6b | PERSON |that tak|
|000002c0| 65 73 20 61 20 6e 61 6d | 65 0a 69 6e 20 69 74 73 |es a nam|e.in its|
|000002d0| 20 63 6f 6e 73 74 72 75 | 63 74 6f 72 20 6c 69 6b | constru|ctor lik|
|000002e0| 65 20 66 6f 6c 6c 6f 77 | 69 6e 67 3a 0a 0a 20 20 |e follow|ing:.. |
|000002f0| 63 6c 61 73 73 20 50 45 | 52 53 4f 4e 20 7b 0a 20 |class PE|RSON {. |
|00000300| 20 20 20 70 75 62 6c 69 | 63 3a 0a 20 20 20 20 20 | publi|c:. |
|00000310| 20 50 45 52 53 4f 4e 28 | 63 6f 6e 73 74 20 53 54 | PERSON(|const ST|
|00000320| 52 49 4e 47 26 20 6e 6d | 29 3b 0a 20 20 20 20 20 |RING& nm|);. |
|00000330| 20 2e 2e 2e 0a 20 20 20 | 20 70 72 69 76 61 74 65 | .... | private|
|00000340| 3a 0a 20 20 20 20 20 20 | 53 54 52 49 4e 47 20 6e |:. |STRING n|
|00000350| 61 6d 65 3b 0a 20 20 7d | 3b 0a 0a 54 68 65 6e 2c |ame;. }|;..Then,|
|00000360| 20 77 68 65 6e 20 49 20 | 63 72 65 61 74 65 20 61 | when I |create a|
|00000370| 6e 20 69 6e 73 74 61 6e | 63 65 20 6f 66 20 50 45 |n instan|ce of PE|
|00000380| 52 53 4f 4e 20 75 73 69 | 6e 67 20 72 61 77 20 73 |RSON usi|ng raw s|
|00000390| 74 72 69 6e 67 2c 0a 49 | 20 6d 61 79 20 77 72 69 |tring,.I| may wri|
|000003a0| 74 65 20 6c 69 6b 65 20 | 74 68 69 73 3a 0a 0a 20 |te like |this:.. |
|000003b0| 20 50 45 52 53 4f 4e 20 | 6e 6f 6d 6f 28 22 48 69 | PERSON |nomo("Hi|
|000003c0| 64 65 6f 20 4e 6f 6d 6f | 22 29 3b 0a 0a 53 54 52 |deo Nomo|");..STR|
|000003d0| 49 4e 47 20 63 6c 61 73 | 73 2c 20 69 6e 20 74 68 |ING clas|s, in th|
|000003e0| 69 73 20 63 61 73 65 2c | 20 69 73 20 6e 6f 74 20 |is case,| is not |
|000003f0| 61 20 73 6d 61 72 74 20 | 70 6f 69 6e 74 65 72 2c |a smart |pointer,|
|00000400| 20 62 75 74 20 69 74 0a | 63 72 65 61 74 65 73 20 | but it.|creates |
|00000410| 61 20 63 68 61 72 61 63 | 74 65 72 20 62 75 66 66 |a charac|ter buff|
|00000420| 65 72 20 6e 65 77 6c 79 | 20 75 73 69 6e 67 20 27 |er newly| using '|
|00000430| 6e 65 77 27 20 6f 70 65 | 72 61 74 6f 72 20 69 6e |new' ope|rator in|
|00000440| 20 69 74 73 0a 63 6f 6e | 73 74 72 75 63 74 6f 72 | its.con|structor|
|00000450| 20 61 6e 64 20 64 65 6c | 65 74 65 20 69 74 20 69 | and del|ete it i|
|00000460| 6e 20 69 74 73 20 64 65 | 73 74 72 75 63 74 6f 72 |n its de|structor|
|00000470| 2e 0a 0a 49 6e 20 74 68 | 69 73 20 63 61 73 65 2c |...In th|is case,|
|00000480| 20 77 69 6c 6c 20 61 20 | 74 65 6d 70 6f 72 61 72 | will a |temporar|
|00000490| 79 20 73 74 72 69 6e 67 | 20 69 6e 73 74 61 6e 63 |y string| instanc|
|000004a0| 65 20 62 65 20 63 72 65 | 61 74 65 64 3f 0a 44 6f |e be cre|ated?.Do|
|000004b0| 65 73 20 69 74 20 64 65 | 70 65 6e 64 20 6f 6e 20 |es it de|pend on |
|000004c0| 68 6f 77 20 74 6f 20 63 | 72 65 61 74 65 20 74 68 |how to c|reate th|
|000004d0| 65 20 63 6f 6e 73 74 72 | 75 63 74 6f 72 3f 0a 44 |e constr|uctor?.D|
|000004e0| 6f 65 73 20 69 74 20 64 | 65 70 65 6e 64 20 6f 6e |oes it d|epend on|
|000004f0| 20 61 20 63 6f 6d 70 69 | 6c 65 72 3f 20 28 75 6e | a compi|ler? (un|
|00000500| 64 65 66 69 6e 65 64 20 | 69 6e 20 43 2b 2b 20 73 |defined |in C++ s|
|00000510| 70 65 63 2e 3f 29 0a 0a | 49 66 20 49 20 69 6e 69 |pec.?)..|If I ini|
|00000520| 74 69 61 6c 69 7a 65 20 | 74 68 65 20 70 72 69 76 |tialize |the priv|
|00000530| 61 74 65 20 6d 65 6d 62 | 65 72 20 27 6e 61 6d 65 |ate memb|er 'name|
|00000540| 27 20 75 73 69 6e 67 20 | 69 6e 69 74 69 61 6c 69 |' using |initiali|
|00000550| 7a 69 6e 67 0a 6c 69 73 | 74 20 6c 69 6b 65 20 66 |zing.lis|t like f|
|00000560| 6f 6c 6c 6f 77 69 6e 67 | 2c 20 63 61 6e 20 49 20 |ollowing|, can I |
|00000570| 61 76 6f 69 64 20 74 6f | 20 63 72 65 61 74 65 20 |avoid to| create |
|00000580| 61 20 74 65 6d 70 6f 72 | 61 72 79 20 6f 62 6a 65 |a tempor|ary obje|
|00000590| 63 74 3f 0a 0a 20 20 50 | 45 52 53 4f 4e 3a 3a 50 |ct?.. P|ERSON::P|
|000005a0| 45 52 53 4f 4e 28 63 6f | 6e 73 74 20 53 54 52 49 |ERSON(co|nst STRI|
|000005b0| 4e 47 26 20 6e 6d 29 20 | 3a 20 6e 61 6d 65 28 6e |NG& nm) |: name(n|
|000005c0| 6d 29 20 7b 2e 2e 2e 7d | 0a 0a 57 68 79 20 49 20 |m) {...}|..Why I |
|000005d0| 77 61 6e 74 20 74 6f 20 | 6b 6e 6f 77 20 74 68 69 |want to |know thi|
|000005e0| 73 20 69 73 20 62 65 63 | 61 75 73 65 20 49 20 64 |s is bec|ause I d|
|000005f0| 6f 6e 27 74 20 77 61 6e | 74 20 74 6f 20 74 61 6b |on't wan|t to tak|
|00000600| 65 20 65 78 74 72 61 20 | 74 69 6d 65 0a 61 6e 64 |e extra |time.and|
|00000610| 20 6d 65 6d 6f 72 79 20 | 73 70 61 63 65 20 65 76 | memory |space ev|
|00000620| 65 6e 20 69 66 20 69 74 | 27 73 20 74 65 6d 70 6f |en if it|'s tempo|
|00000630| 72 61 72 79 2e 0a 49 27 | 6d 20 70 61 7a 7a 6c 69 |rary..I'|m pazzli|
|00000640| 6e 67 20 6d 79 20 62 72 | 61 69 6e 20 77 68 69 63 |ng my br|ain whic|
|00000650| 68 20 49 27 64 20 62 65 | 74 74 65 72 20 74 6f 20 |h I'd be|tter to |
|00000660| 74 61 6b 65 20 62 65 74 | 77 65 65 6e 20 72 65 66 |take bet|ween ref|
|00000670| 65 72 65 6e 63 65 0a 61 | 70 70 72 6f 61 63 68 20 |erence.a|pproach |
|00000680| 64 65 73 63 72 69 62 65 | 64 20 61 62 6f 76 65 20 |describe|d above |
|00000690| 61 6e 64 20 70 6f 69 6e | 74 65 72 20 61 70 70 72 |and poin|ter appr|
|000006a0| 6f 61 63 68 20 6c 69 6b | 65 20 66 6f 6c 6c 6f 77 |oach lik|e follow|
|000006b0| 69 6e 67 3a 0a 0a 20 20 | 63 6c 61 73 73 20 50 45 |ing:.. |class PE|
|000006c0| 52 53 4f 4e 20 7b 0a 20 | 20 20 20 70 75 62 6c 69 |RSON {. | publi|
|000006d0| 63 3a 0a 20 20 20 20 20 | 20 50 45 52 53 4f 4e 28 |c:. | PERSON(|
|000006e0| 63 6f 6e 73 74 20 63 68 | 61 72 2a 20 6e 6d 29 3b |const ch|ar* nm);|
|000006f0| 0a 20 20 20 20 20 20 2e | 2e 2e 0a 20 20 20 20 70 |. .|... p|
|00000700| 72 69 76 61 74 65 3a 0a | 20 20 20 20 20 20 53 54 |rivate:.| ST|
|00000710| 52 49 4e 47 20 6e 61 6d | 65 3b 0a 20 20 7d 3b 0a |RING nam|e;. };.|
|00000720| 0a 49 6e 20 74 68 69 73 | 20 63 61 73 65 20 28 70 |.In this| case (p|
|00000730| 6f 69 6e 74 65 72 20 61 | 70 70 72 6f 61 63 68 29 |ointer a|pproach)|
|00000740| 2c 20 2a 6e 6f 2a 20 74 | 65 6d 70 6f 72 61 72 79 |, *no* t|emporary|
|00000750| 20 6f 62 6a 65 63 74 20 | 77 69 6c 6c 20 62 65 0a | object |will be.|
|00000760| 63 72 65 61 74 65 64 2e | 20 41 6c 73 6f 2c 20 74 |created.| Also, t|
|00000770| 68 69 73 20 63 6f 6e 73 | 74 72 75 63 74 6f 72 20 |his cons|tructor |
|00000780| 63 61 6e 20 61 63 63 65 | 70 74 20 53 54 52 49 4e |can acce|pt STRIN|
|00000790| 47 20 6f 62 6a 65 63 74 | 2c 20 62 65 63 61 75 73 |G object|, becaus|
|000007a0| 65 0a 53 54 52 49 4e 47 | 20 63 6c 61 73 73 20 68 |e.STRING| class h|
|000007b0| 61 73 20 61 20 63 6f 6e | 76 65 72 73 69 6f 6e 20 |as a con|version |
|000007c0| 6f 70 65 72 61 74 6f 72 | 20 74 6f 20 22 63 6f 6e |operator| to "con|
|000007d0| 73 74 20 63 68 61 72 2a | 22 2c 20 61 6e 64 20 69 |st char*|", and i|
|000007e0| 74 0a 77 6f 72 6b 73 20 | 69 6d 70 6c 69 63 69 74 |t.works |implicit|
|000007f0| 6c 79 2e 20 28 44 6f 65 | 73 20 74 68 69 73 20 66 |ly. (Doe|s this f|
|00000800| 65 61 74 75 72 65 20 62 | 72 69 6e 67 20 61 6e 6f |eature b|ring ano|
|00000810| 74 68 65 72 20 61 72 67 | 75 65 3f 29 0a 0a 0a 28 |ther arg|ue?)...(|
|00000820| 49 66 20 74 68 69 73 20 | 69 73 20 61 20 46 41 51 |If this |is a FAQ|
|00000830| 2c 20 70 6c 65 61 73 65 | 20 66 6f 72 67 69 76 65 |, please| forgive|
|00000840| 20 6d 65 2e 20 54 68 65 | 6e 20 49 20 61 70 70 72 | me. The|n I appr|
|00000850| 65 63 69 61 74 65 0a 69 | 66 20 79 6f 75 20 6c 65 |eciate.i|f you le|
|00000860| 74 20 6d 65 20 6b 6e 6f | 77 2e 29 0a 0a 54 68 61 |t me kno|w.)..Tha|
|00000870| 6e 6b 20 79 6f 75 2c 0a | 0a 2d 2d 48 69 72 6f 73 |nk you,.|.--Hiros|
|00000880| 68 69 20 4d 61 74 73 75 | 73 68 69 74 61 20 40 20 |hi Matsu|shita @ |
|00000890| 53 65 69 6b 6f 20 45 70 | 73 6f 6e 20 43 6f 72 70 |Seiko Ep|son Corp|
|000008a0| 2e 20 28 6d 61 74 75 73 | 69 74 61 40 68 76 2e 65 |. (matus|ita@hv.e|
|000008b0| 70 73 6f 6e 2e 63 6f 2e | 6a 70 29 0a 0a |pson.co.|jp).. |
+--------+-------------------------+-------------------------+--------+--------+